package com.ryskoo.common.hclconstant;

/**
 * 订单状态
 *
 * @author BeHappy
 *
 * ①餐饮行业
 * 堂食：订单已提交、商家已接单、订单已完成、订单已取消
 * 外卖：订单已提交、商家已接单、订单派送中、订单已送达、订单已取消
 * 预约（待定）：预约成功、菜品已就绪、订单已完成、订单已取消
 *
 * ②鲜花行业
 * 快递：订单已提交、商家已接单、订单派送中、订单已送达、订单已取消
 * 上门自提：订单已提交、商家已接单、订单已完成、订单已取消
 */
public enum OrderStateEnum {
    SUBMIT(1, "订单已提交"),
    VENDOR_RECEIVE(2, "商家已接单"),
    DELIVERY(3, "订单配送中"),
    FINISH(4, "订单已完成"),
    ARRIVED(5, "订单已送达"),
    CANCELED(-1, "订单已取消");
    private int value;
    private String name;

    OrderStateEnum(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByValue(int value) {
        for (OrderStateEnum ose : OrderStateEnum.values()) {
            if (ose.getValue() == value) {
                return ose.getName();
            }
        }
        return "";
    }
}
